home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Trusted Irix /B 4.0.4
/
Trusted-Irix B-4.0.1.iso
/
dist
/
eoe1.idb
/
usr
/
include
/
sys
/
jag.h.z
/
jag.h
Wrap
C/C++ Source or Header
|
1992-04-03
|
9KB
|
268 lines
/*
* Structures used in jag (Interphase 4210 Jaguar) driver.
*/
#define JAG_CTLRS 8 /* max # of controllers */
#define JAG_UPC 14 /* max units per controller */
#define JAG_LUPC 16 /* logical units per controller */
#define JAG_NCQE 15 /* number command queue entries */
#define JAG_DMABURST 0
#define JAG_SELTIMEOUT 250 /* 250 milliseconds */
#define JAG_CMDTIMEOUT 0 /* no command timeout */
#define JAG_VMETIMEOUT 0 /* 100 milliseconds */
#define JAG_NRETRY 4 /* really 3 retries */
#define JAG_LEN_SENSE 64 /* maximum accepted sense length */
#define JAG_LEN_INQUIRY 128 /* maximum accepted inquiry length */
/* Master Control Status Block */
struct jag_mcsb
{
ushort msr; /* master status register */
ushort mcr; /* master control register */
ushort iqar; /* interrupt on CQE available */
ushort qhdp; /* CQE head pointer */
ushort thaw; /* thaw work queue register */
ushort reserve1;
ushort reserve2;
ushort reserve3;
};
/* Controller Initialization Block */
struct jag_cib
{
ushort ncqe; /* number of command queue entries */
ushort dmaburst; /* DMA burst count */
ushort normal_vec; /* normal command completion vector */
ushort error_vec; /* errored command completion vector */
ushort scsi0_id; /* ID of Jaguar controller channel 0 */
ushort scsi1_id; /* ID of Jaguar controller channel 1 */
ushort crb_offset; /* offset of Command Response Block */
ushort sel_timeout_h; /* timeout in milliseconds for select */
ushort sel_timeout_l; /* timeout in milliseconds for select */
ushort wq0_timeout_h; /* timeout in 256ms for scsi commands in WQ 0 */
ushort wq0_timeout_l; /* timeout in 256ms for scsi commands in WQ 0 */
ushort vme_timeout_h; /* timeout in 30ms for VME transactions */
ushort vme_timeout_l; /* timeout in 30ms for VME transactions */
ushort reserve1;
ushort reserve2;
ushort crb_memtype; /* type, size, addr mod for offboard crb */
ushort crb_addr_h; /* address of offboard crb */
ushort crb_addr_l; /* address of offboard crb */
ushort err_recovery; /* flag to enable work queue freezing */
ushort reserve3;
};
/* Command Queue Entry */
struct jag_cqe
{
ushort qecreg; /* queue entry control register */
ushort iopbaddr; /* addr for iopbs in HUS */
/* mem type, size, addr mod for offboard */
union
{
ulong on;
struct
{
ushort tagh;
ushort tagl;
} off;
} tag;
u_char iopblen; /* iopb length */
u_char wq_num; /* work queue number */
ushort reserve1;
};
/* SCSI passthru IOPB structure (works for most other IOPB's) */
struct jag_iopb
{
ushort cmd; /* command to do */
ushort options; /* options on command */
ushort status; /* status byte returned from SCSI bus */
ushort reserve1;
u_char intvector; /* normal (good) completion vector */
u_char errvector; /* error command completion vector */
ushort intlevel; /* interrupt level */
ushort reserve2;
ushort iopb_memtype; /* xfer type, xfer size, addr mode for data */
ulong addr; /* address of data */
ulong length; /* max length of data to xfer */
ulong reserve3;
ushort reserve4;
ushort unit; /* unit to send command to */
u_char scsi[12]; /* actual SCSI command */
};
/* Initialize Work Queue IOPB structure */
struct jag_wqiopb
{
ushort cmd; /* command to do */
ushort options; /* options on command */
ushort status; /* return status */
ushort reserve1;
u_char intvector; /* normal (good) completion vector */
u_char errvector; /* error command completion vector */
ushort intlevel; /* interrupt level */
ushort ngroup; /* number of commands to group */
ushort reserve2[7];
ushort wqnum; /* work queue number */
ushort wopt; /* work queue options */
ushort nslots; /* number of slots in work queue */
ushort priority; /* priority of this work queue */
ushort timeout; /* command timeout for this queue */
ushort reserve3;
};
/* Command Response Block */
struct jag_crb
{
ushort crsw; /* Command Response Status Word */
ushort reserve1;
ulong tag; /* command tag */
u_char iopblen; /* iopb length */
u_char wq_num; /* work queue number */
ushort reserve2;
struct jag_iopb iopb; /* returned iopb */
};
/* Configuration Status Block */
struct jag_csb
{
ushort reserve1;
u_char reserve2;
u_char product[3];
ushort reserve3;
u_char reserve4;
u_char variation;
ushort reserve5;
u_char reserve6;
u_char fwrev[3];
ushort reserve7;
u_char fwdate[8];
ushort reserve8;
ushort bufsize;
ulong reserve9;
u_char id0; /* SCSI id of controller on channel 0 */
u_char id1; /* SCSI id of controller on channel 1 */
u_char lastsel0; /* SCSI id of most recent selection channel 0 */
u_char lastsel1; /* SCSI id of most recent selection channel 1 */
u_char phase0; /* Phase sense on channel 0 */
u_char phase1; /* Phase sense on channel 1 */
u_char reserveA;
u_char daughter; /* Type of daughter board */
u_char reserveB;
u_char SW_DIP; /* Status of switches on switch block SW2 */
ushort frozenwq; /* Frozen Work Queues bitmap */
};
/*
* Macros for determining unit number and controller number
*/
#define JAGCTLR(dev) ((dev & 0x700) >> 8)
#define JAGUNIT(dev) ((int) jag_unitnum[(dev & 0xF0) >> 4])
#define JAGFS(dev) (dev & 0xF)
/*
* Driver structures. The jagunitqueue structure must look something
* like the iobuf. It must at least be identical up to the b_actl field.
*/
struct jagunitqueue
{
sema_t fill; /* replaces b_lock in iobuf */
int b_flags; /* see buf.h */
struct buf *b_forw; /* first buffer from strategy */
struct buf *b_back; /* last buffer from strategy */
struct buf *b_actf; /* head of I/O queue (b_forw)*/
struct buf *b_actl; /* tail of I/O queue (b_back)*/
short qlength; /* number of bufs waiting for this unit */
char specialwait; /* there is a driver generated i/o waiting */
char speciallen; /* length of scsi command */
uint specialtime; /* timeout wait for special command */
};
struct jagunitinfo
{
u_char number; /* unit number of this unit (0-13) */
u_char devnum; /* device number (0-15) */
u_char present; /* unit is connected */
u_char status; /* unit is busy with a command */
u_char attn; /* unit attention occurred */
struct jagunitqueue *queue; /* pointer to device's queue */
int timeout_id; /* timeout id */
dmamap_t *dmamap; /* dmamap associated with unit */
struct jag_iopb iopb; /* used for driver generated requests */
sema_t iopbsema;
sema_t iopbdone;
char iopbsense[JAG_LEN_SENSE]; /* sense for driver gen'd reqs */
ushort iopberror; /* iopb error retry counter */
char iopbsvalid; /* sense data valid flag */
char sense_err; /* sense error indicator */
char *sensedata; /* request sense data */
char *inq; /* inquiry data */
uint capacity[2]; /* disk capacity in sectors */
struct volume_header *vh; /* disk volume header */
};
/* constants for jagunitinfo.present */
#define JAG_UI_TAPE 1
#define JAG_UI_DISK 2
/* constants for jagunitinfo.status */
#define JAG_UISTAT_IDLE 0 /* no iopb outstanding for unit */
#define JAG_UISTAT_REG 1 /* regular read/write iopb outstanding */
#define JAG_UISTAT_SPEC 2 /* special driver generated iopb oustanding */
#define JAG_UISTAT_SENSE 4 /* request sense outstanding */
struct jagctlrinfo
{
lock_t lock;
u_char number; /* number of this controller */
u_char present; /* flag indicating if ctlr is installed */
u_char vmebusno; /* number of VME bus ctlr is installed in */
ushort cmdcount; /* count of outstanding commands */
u_char reset[2]; /* set if resetting scsi busses */
volatile struct jag_mcsb *mcsb; /* short i/o master command/status */
volatile struct jag_cqe *mce; /* short i/o master command entry */
volatile struct jag_cqe *cmdq; /* short i/o command queue pointer */
volatile short *hus; /* host usable space pointer */
volatile struct jag_crb *crb; /* off board command response block */
volatile struct jag_csb *csb; /* configuration status block pointer */
struct jagunitinfo *unit[JAG_UPC]; /* unit info */
};
struct memcqe
{
volatile struct jag_cqe *cqe_offboard; /* pointer to offboard cqe */
struct jag_cqe cqe; /* command queue entry for the unit */
struct jag_iopb iopb; /* iopb for the unit */
};
struct jagrequest
{
u_char *scsicmd; /* scsi command */
uint scsilen; /* length of scsi command */
char *sense; /* sense data from command if any */
char *buffer; /* location of data */
uint buflen; /* amount of data to transfer */
uint direction; /* read = 1 */
uint timeout; /* in seconds */
};
/* defines for jagrequest.direction */
#define JDIR_IN_CLEAN 0 /* receive data from peripheral */
#define JDIR_OUT_CLEAN 1 /* send data to peripheral */
#define JDIR_IN_DIRTY 2 /* needs a dcache_inval */
#define JDIR_OUT_DIRTY 3 /* needs a dcache_wb */
#define JDIR_OUT 1 /* bit mask */
#define JDIR_DIRTY 2 /* bit mask */